//
//  AFNTools.m
//  豆瓣
//
//  Created by dllo on 15/9/10.
//  Copyright (c) 2015年 . All rights reserved.
//

#import "AFNTools.h"

@implementation AFNTools

+ (void)getAFN:(NSString *)string andpara:(NSDictionary *)para andBlock:(AFNblock)block andfailBlock:(Fairblock)fairblock
{
    
    AFNetworkReachabilityManager *Netmanger = [AFNetworkReachabilityManager sharedManager];
    NSString *url_string = string;
    
    
  
    
    
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];
    [manager GET:url_string parameters:para success:^(NSURLSessionDataTask *operation, id responseObject) {
    [Netmanger stopMonitoring];
     //   //NSLog(@"使用AFN进行get请求 ===  %@",responseObject);
        
        
        
        
        
        block(responseObject);
 
    }failure:^(NSURLSessionDataTask *operation, NSError *error) {
        fairblock (error);
    }];
    
    


}

@end
